/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.koller.million.grid.frame.enc;

import de.koller.million.grid.engine.player.Player;


/**
 *
 * @author User
 */
public class EncPlayerPanel extends javax.swing.JPanel {
	
	private final Player player;
	private final IVolatileValue pHealth;

	/**
	 * Creates new form EncPlayerPanel
	 */
	public EncPlayerPanel() {
		player = null;
		pHealth = null;
		initComponents();
	}

	public EncPlayerPanel( Player player ) {
		this.player = player;
		if( player == null )
			pHealth = null;
		else
			pHealth = this.player.playerStats.hpValue;
		initComponents();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings( "unchecked" )
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        gBar1 = new de.koller.million.grid.frame.enc.GBar( pHealth );

        setBorder(javax.swing.BorderFactory.createTitledBorder(player == null ? "Unbelegt" : player.toString()));
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout gBar1Layout = new javax.swing.GroupLayout(gBar1);
        gBar1.setLayout(gBar1Layout);
        gBar1Layout.setHorizontalGroup(
            gBar1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 171, Short.MAX_VALUE)
        );
        gBar1Layout.setVerticalGroup(
            gBar1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 17, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(gBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(gBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
    }// </editor-fold>//GEN-END:initComponents

	private void formMouseClicked( java.awt.event.MouseEvent evt ) {//GEN-FIRST:event_formMouseClicked
		
	}//GEN-LAST:event_formMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private de.koller.million.grid.frame.enc.GBar gBar1;
    // End of variables declaration//GEN-END:variables
}
